<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>JavaScripTools Manual</title>
    <link rel="stylesheet" type="text/css" href="../../css/style.css">
</head>

<body>
<br>
<h1>JavaScripTools Manual</h1>
<h2>General</h2>
<h3>Customizing the default values</h3>
<p>On most scripts (all but JavaScriptUtil) there are values that can be customized,
and assume a default value. Most of them can be customized using "constants" (they are
actually variables following the Java constant name convention, that is, UPPERCASE_NAME).
Those constants default value migth not be your use (for example: I am brazilian, so the
parsers default formatting options reflect the brazilian conventions, like 1.234,56 and
31/12/2000).</p>
<p>The best way to set those default values is to create a JavaScript file containing only 
the redefinitions for the constants you want to redefine, and include that file <b>after</b>
including the JavaScripTools scripts. Here is an example to customize the parsers default
values for the US locale (assume the file is called defaults.js):</p>
<pre>JST_DEFAULT_DECIMAL_SEPARATOR = ".";
JST_DEFAULT_GROUP_SEPARATOR = ",";
JST_DEFAULT_USE_GROUPING = true;
JST_DEFAULT_CURRENCY_SYMBOL = "$";
JST_DEFAULT_DATE_MASK = "MM/dd/yyyy";
</pre>
<p>Then, include the script files (assume they are inside the js directory. If not, replace
if to the correct path to the scripts):</p>
<pre>&lt;script src="js/JavaScriptUtil.js"/&gt;&lt;/script&gt;
&lt;script src="js/Parsers.js"/&gt;&lt;/script&gt;
&lt;script src="js/InputMask.js"/&gt;&lt;/script&gt;
&lt;script src="js/JavaScripTable.js"/&gt;&lt;/script&gt;
&lt;script src="js/defaults.js"/&gt;&lt;/script&gt;
</pre>
<p>Another way is to directly change the default constant values, but it is not recommended,
since it can only be applied on the uncompressed (original) scripts (it is VERY hard to find
things on the compressed scripts), and every update on the JavaScripTools library would change
those values back to the "factory default".</p>
<br><br>
<hr>
<table width="100%">
    <tr>
        <td width="33%" align="left"><b>Previous:</b><br><a href="General_organization.html">The file disposition on the release archive</a></td>
        <td width="34%" align="center"><a href="index.html">Table of Contents</a></td>
        <td width="33%" align="right"><b>Next:</b><br><a href="JavaScriptUtil_intro.html">Introduction to JavaScriptUtil</a></td>
    </tr>
</table>

</body>
</html>
